<template>
  <div class="app-container">
    <el-table
      :data="this.list"
      stripe
      style="width: 100%"
      sortable ="true"
    >
      <el-table-column label="实验室" width="110" align="center" prop="region">
      </el-table-column >
      <el-table-column label="状态" width="110" align="center">
            <span>审核中</span>
      </el-table-column>
      <el-table-column label="使用器材" prop="materials">
      </el-table-column>
      <el-table-column label="使用人" width="110" align="center" prop="name">
      </el-table-column>
      <el-table-column class-name="status-col" label="开始时间" width="300" align="center" prop="date1">
      </el-table-column>
      <el-table-column label="备注" width="200" align="center" prop="desc">
      </el-table-column >
      <el-table-column
      align="right">
      <template slot="header">
        <el-input
          v-model="search"
          size="mini"
          placeholder="输入关键字搜索"/>
      </template>
      <template slot-scope="scope">
        <el-button
          type="success"
          @click="handleDelete(scope.$index, scope.row)">同意</el-button>
      </template>
    </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: this.$store.state.lab,
    }
  },
  created() {
    // console.log("11111111"+this.$store.state.lab)
    for(var i=0;i<this.$store.state.lab.length;i++){
      // this.list.push(this.$store.state[i])
      // console.log(this.list)
      this.list[i].date1=this.list[i].date1.toString().substr(0,15)
    }
  },
  methods: {
    handleDelete(index, rows) {
    // console.log("index is "+index+",row is"+rows)
    // console.log("rows is ");
    
    // console.log(rows);
    // console.log("1111");
    
    // console.log(this.$store.state.lab);
    
        this.list.splice(index, 1);
        // var mm=this.$store.state.lab
        // mm.push(rows)
        // console.log("2222");
        
        // console.log(mm);
        
        // this.$store.commit("setLab",mm)
        // console.log(mm+"---------------"+this.$store.state.lab)
    }
  }
}
</script>
